﻿using Downloader.Domain;
using FluentNHibernate.Automapping.Alterations;

namespace Downloader.Infrastructure.NHibernateMaps
{
    public class CategoryMap:IAutoMappingOverride<Category>
    {
        public void Override(FluentNHibernate.Automapping.AutoMapping<Category> mapping)
        {
            mapping.HasMany(c => c.Subs).KeyColumn("ParentFk").ForeignKeyConstraintName("fk_Category_ParentCategory").
                LazyLoad().Cascade.AllDeleteOrphan();
        }
    }
}
